package com.franklions.nacos.example.config;

import com.alibaba.nacos.api.config.annotation.NacosConfigListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author flsh
 * @version 1.0
 * @date 2023/3/13
 * @since Jdk 1.8
 */
@Configuration
public class AppConfig {

    @NacosConfigListener(dataId = "nacos-example-app", timeout = 500)
    public void onChange(String newContent) throws Exception {
        System.out.println("onChange : " + newContent);
    }

    @Bean
    public AppConfigPropertiesBean appConfigPropertiesBean(){
        AppConfigPropertiesBean bean = new AppConfigPropertiesBean();
        return bean;
    }
}
